let arr = [5, 6, 7, 8, 1, 2, 3];
console.log(arr.slice(0, 3)); // [5, 6, 7]
console.log(arr.slice(1, 4)); // [6, 7, 8]
console.log(arr.slice(-1)); // [3]
console.log(arr.slice(-3, -1)); // [1, 2]
console.log(arr.slice(-2)); // [2, 3]
let arr1 = [
  { name: 'zg', age: 18 },
  { name: 'kobe', age: 35 },
  { name: 'lucy', age: 22 },
];
console.log(arr1.slice(3, 5)); // []
console.log(arr1.slice(0)); 
/**结果
  {name: 'zg', age: 18}
  {name: 'kobe', age: 35}
  {name: 'lucy', age: 22}
*/ 